import request from '@/utils/request'
import type { infoResponseData, trademarkData } from './model/trademark'

// 枚举API
enum API{
    TRADEMARK= '/admin/product/baseTrademark/',
    ADDTRADEMARK = '/admin/product/baseTrademark/save',
    UPDATETRADEMARK = '/admin/product/baseTrademark/update',
    DELETETRADEMARK = '/admin/product/baseTrademark/remove/'
}

// 获取品牌管理分页列表的接口
export const reqTrademarkList = (page:number,limit:number)=>request.get<any,infoResponseData>(API.TRADEMARK + `${page}/${limit}`)

// 添加或修改品牌数据的接口
export const reqAddOrUpdateTrademark = (data:trademarkData)=>{
    // 有id修改 没有就添加
    if(data.id){
        request.put<any,any>(API.UPDATETRADEMARK,data)
    }else{
        request.post<any,any>(API.ADDTRADEMARK,data)
    }
}

// 删除品牌的接口
export const reqDeleteTrademark = (data:trademarkData)=>request.delete(API.DELETETRADEMARK + data.id)